﻿@using Libraries;
@model Common.SqliteDBHelper.ColumnInfo
@{
    ViewBag.Title = "EditColumn";
    Layout = "~/Areas/Manager/Views/Shared/_SqliteLayoutPage.cshtml";
    Dictionary<string, string> olts = new Dictionary<string, string>();
    Dictionary<string, string> olts2 = new Dictionary<string, string>();

    olts.Add("是", "True");
    olts.Add("否", "False");

    foreach (var item in Enum.GetNames(typeof(Common.SqliteDBHelper.SqliteDBDataType)))
    {
        olts2.Add(item, item);
    }
}
<div class="panel panel-primary">
    <div class="panel-heading">
        <h3 class="panel-title">编辑 @ViewBag.TableName 表 @Model.Name 列</h3>
    </div>
    <div class="panel-body">
        <form class="form-horizontal" role="form" action="" method="post">
            <input type="hidden" name="TableName" id="TableName" value="@ViewBag.TableName" />
            <input type="hidden" name="Ordinal" id="Ordinal" value="@Model.Ordinal" />
            <div class="form-group" style="border-bottom: 1px solid #eee; padding-bottom: 9px;">
                <label class="col-sm-2 control-label">列名</label>
                <div class="col-sm-10">
                    <input type="text" name="Name" id="Name" class="form-control" value="@Model.Name" required="required" />
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">是否主键</label>
                <div class="col-sm-10">
                    @Html.DropDownListFor("IsPrimaryKey", "IsPrimaryKey", Model.IsPrimaryKey.ToString(), olts)
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">字段类型</label>
                <div class="col-sm-10">
                    @Html.DropDownListFor("DataTypeName", "DataTypeName", Model.DataTypeName, olts2)
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">字段长度</label>
                <div class="col-sm-10">
                    <input type="text" name="MaxLength" id="MaxLength" class="form-control" value="@Model.MaxLength" required="required">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">是否可空</label>
                <div class="col-sm-10">
                    @Html.DropDownListFor("AllowDBNull", "AllowDBNull", Model.AllowDBNull.ToString(), olts)
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label"></label>
                <div class="col-sm-10">
                    <button type="submit" class="btn btn-primary">确定</button>
                    <button type="button" class="btn btn-default" onclick="history.back();">返回</button>
                </div>
            </div>
        </form>
    </div>
</div>
